package com.example.demo.controller;

import com.example.demo.model.User;
import org.springframework.web.bind.annotation.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: WHY
 * Date: 2023-08-04
 * Time: 20:21
 */
@RestController
@RequestMapping("/u")
public class UserController {

    @RequestMapping("/getUser")
    public User getUser(User user){

        return user;
    }
    @RequestMapping("/name")
        public String name (@RequestParam(value="n",required = false) String name) {
            return name;

    }

    @RequestMapping("/transjson")

    public User transjson(@RequestBody User user){
        return user;
    }
    @RequestMapping("/html")
    public String html(){
        return "<h1>hello html</h1>";
    }
    /**
     * 以获取文章id为例
     */
//    @RequestMapping("/article/{id}")
//    public Integer article(@PathVariable("id") Integer aid){
//        return aid;
//
//    }
    @RequestMapping("/article/{aid}/{name}")
    public String  article2(@PathVariable Integer aid,@PathVariable String name){
        return "id"+aid+"name"+name;

    }
    @RequestMapping("file")


}
